package main

import "github.com/gin-gonic/gin"

// bind validate
type User struct {
	ID   string `form:"id" binding: "required"`
	UUID string `form:"uuid" binding: "required"`
}

func main() {
	r := gin.Default()
	r.GET("user", func(c *gin.Context) {
		var user User
		// 绑定查询
		if err := c.ShouldBindQuery(&user); err != nil {
			c.Status(404)
			return
		}

		c.JSON(200, gin.H{
			"name": 0,
			"id":   user.UUID,
		})
	})
	r.Run()
}
